$(function(){



    /*
    * 页面满屏
    /* 渲染公告信息*/
    /******************************************************/
    initPage();
    function initPage() {
        let searchInfo = getSearchInfo();
        console.log(searchInfo);
        $.ajax({
            type: 'post',
            url : '/announcemen/details_announcemenn.do',
            data : searchInfo,
            dataType : 'json',
            xhrFields : {
                withCredentials: true
            },
            crossDomain: true,
            success: function (data) {
                console.log(data);
                if(data.status == 0){
                    addADinfo( data.data );
                }else{
                    spop_waring( data.msg);
                }
            }
        });
    }
    function addADinfo( data ) {
        $('#ad-Title').text(data.annid);// 标题信息
        $('#itemInfo-body').html(data.anndetail);// 公告主体

        // 文件渲染
        $('#downFiles').html('');
        if( !data.attachmentname ){
            $('#downFiles').append($('<span class="text-lowercase">暂无附件</span>'));
        }else{
            let aFileName = data.attachmentname.split('|');
            let aFileUrl = data.attachmenturl.split('|');
            // 文件渲染至页面
            for( let i=0; i<aFileName.length; i++ ){
                let DOM = $('<span class="text-lowercase">' +
                                '<a class="mar-10 mar-r" target="_blank" href="'+ aFileUrl[i] +'" download="'+ aFileName[i] +'">'+ aFileName[i] +'<i class="glyphicon glyphicon-download-alt"></i></a>' +
                                '' +
                            '</span>');
                DOM.appendTo( $('#downFiles') );
            }
        }
    }
});